package com.golfwithfriends.model;

import java.util.ArrayList;
import java.util.List;

public class Player {

	private String nom;
	private List<Trou> holes;
	
	public Player(String n, int nb_holes)
	{
		super();
		this.nom = n;
		this.holes = new ArrayList<Trou>();
		
		if (nb_holes > 0 && nb_holes < 19)
		{
			for (int i = 0; i < nb_holes; i++)
			{
				this.holes.add(new Trou(i+1));
			}
		}
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}
	
	public Trou getTrouAtIndex(int i)
	{
		if (i < holes.size())
			return holes.get(i);
		return null;
	}
}
